package com.whmall.service.crm.module.companycertificatechemical.impl.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.whmall.service.crm.entity.dto.companycertificatechemical.CompanyCertificateChemicalStatisticDTO;
import com.whmall.service.crm.module.companycertificatechemical.entity.CompanyCertificateChemicalDO;
import com.whmall.service.crm.module.companycertificatechemical.entity.qo.CompanyCertificateChemicalQO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 公司证照化合物关联Mapper
 *
 * @author alex
 * @since 2020/8/17
 */
@Mapper
public interface CompanyCertificateChemicalMapper extends BaseMapper<CompanyCertificateChemicalDO> {

    int insertMultiple(
            @Param("records") List<CompanyCertificateChemicalDO> records);

    int insertSelective(CompanyCertificateChemicalDO record);

    int updateByIdSelective(CompanyCertificateChemicalDO record);

    CompanyCertificateChemicalDO getById(Long id);

    List<CompanyCertificateChemicalDO> listByIds(
            @Param("ids") List<Long> ids);

    List<CompanyCertificateChemicalDO> listByChemicalIds(
            @Param("chemicalIds") List<Long> chemicalIds);

    List<CompanyCertificateChemicalDO> listByCertificateIds(
            @Param("certificateIds") List<Long> certificateIds);

    List<CompanyCertificateChemicalDO> listByCompanyIdCertificateIdAndChemicalIds(
            @Param("companyId") Long companyId,
            @Param("certificateId") Long certificateId,
            @Param("chemicalIds") List<Long> chemicalIds);

    List<CompanyCertificateChemicalDO> listBy(CompanyCertificateChemicalQO qo);

    List<CompanyCertificateChemicalDO> listByCompanyIdAndCertificateId(@Param("companyId") Long companyId,
                                                                       @Param("certificateId") Long certificateId);

    List<Long> listAllCertificateId();

    int countBy(CompanyCertificateChemicalQO qo);

    List<CompanyCertificateChemicalStatisticDTO> countGroupByCompany(CompanyCertificateChemicalQO queryReqDTO);
}